#!/bin/bash -e

function info() {
    echo Usage: `basename $0` [-p out_prefix -s out_suffix] t.bam n.bam n.vcf
    exit 1
}

while getopts ":p:s:t:" opt; do
    case $opt in
        p) out_prefix=$OPTARG;;
        s) out_suffix=$OPTARG;;
        t) threads=$OPTARG;;
        ?) info;;
    esac
done
shift $(($OPTIND - 1))

if [ $# -lt 2 ]; then info; fi

. $var || :

echo tumor contamination estimation
$java_run/gatk38 \
-T ContEst \
-R $ref_genome \
-I:eval $1 \
-I:genotype $2 \
-nct $nct \
--popfile $hapmap \
--interval_set_rule INTERSECTION \
-o $out_prefix.t.cont_est.txt \


echo normal contamination estimation
$java_run/gatk38 \
-T ContEst \
-R $ref_genome \
-I:eval $2 \
--genotypes $3 \
-nct $nct \
--popfile $hapmap \
--interval_set_rule INTERSECTION \
-o $out_prefix.n.cont_est.txt \

. $cmd_done

